openapi: 3.0.0
info:
  title: Kitchen Ingredients API
  version: 1.0.0
servers:
  - url: https://dev.api.example.com
    description: Development server
  - url: https://stg.api.example.com
    description: Staging server
  - url: '{{OUR_SERVER}}'
    description: Production server
paths:
  /ingredients:
    get:
      summary: List ingredients
      responses:
        '200':
          description: List of ingredients
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                  page:
                    type: object
                    properties:
                      endCursor:
                        type: string
                      startCursor:
                        type: string
                      hasNextPage:
                        type: boolean
                      hasPrevPage:
                        type: boolean
                      limit:
                        type: integer
                      total:
                        type: integer
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        object:
                          type: string
                        kitchenId:
                          type: string
                        name:
                          type: string
                        quantity:
                          type: number
                        unit:
                          type: string
                        useBefore:
                          type: string
                          format: date-time
                        createdAt:
                          type: string
                          format: date-time
                  total:
                    type: integer
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  title:
                    type: string
                  detail:
                    type: string
                  status:
                    type: integer
                  type:
                    type: string
                  instance:
                    type: string
    post:
      summary: Add a new ingredient
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                quantity:
                  type: number
                unit:
                  type: string
                useBefore:
                  type: string
                  format: date-time
              required:
                - kitchenId
                - name
                - quantity
                - unit
                - useBefore
      responses:
        '201':
          description: Ingredient created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  object:
                    type: string
                  kitchenId:
                    type: string
                  name:
                    type: string
                  quantity:
                    type: number
                  unit:
                    type: string
                  useBefore:
                    type: string
                    format: date-time
                  createdAt:
                    type: string
                    format: date-time
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  title:
                    type: string
                  detail:
                    type: string
                  status:
                    type: integer
                  type:
                    type: string
                  instance:
                    type: string
  /ingredients/{id}:
    delete:
      summary: Delete an ingredient by ID
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '204':
          description: Ingredient deleted successfully
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  title:
                    type: string
                  detail:
                    type: string
                  status:
                    type: integer
                  type:
                    type: string
                  instance:
                    type: string
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  title:
                    type: string
                  detail:
                    type: string
                  status:
                    type: integer
                  type:
                    type: string
                  instance:
                    type: string
    get:
      summary: Get an ingredient by ID
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Ingredient details
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  object:
                    type: string
                  kitchenId:
                    type: string
                  name:
                    type: string
                  quantity:
                    type: number
                  unit:
                    type: string
                  useBefore:
                    type: string
                    format: date-time
                  createdAt:
                    type: string
                    format: date-time
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  title:
                    type: string
                  detail:
                    type: string
                  status:
                    type: integer
                  type:
                    type: string
                  instance:
                    type: string
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  title:
                    type: string
                  detail:
                    type: string
                  status:
                    type: integer
                  type:
                    type: string
                  instance:
                    type: string
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
security:
  - BearerAuth: []
